<!-- HTML header for doxygen 1.9.4-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>yyjson: Building and testing</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
<link href="doxygen-awesome-sidebar-only.css" rel="stylesheet" type="text/css"/>
<link href="doxygen-awesome-sidebar-only-darkmode-toggle.css" rel="stylesheet" type="text/css"/>
<link href="yyjson-style.css" rel="stylesheet" type="text/css"/>
<!-- css awesome -->
 <script type="text/javascript" src="doxygen-awesome-darkmode-toggle.js"></script>
 <script type="text/javascript">
     DoxygenAwesomeDarkModeToggle.init()
 </script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname"><a href="index.html">yyjson</a><span id="projectnumber">&#160;0.10.0</span>
   </div>
   <div id="projectbrief">A high performance C JSON library.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('md_doc__build_and_test.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div><div class="header">
  <div class="headertitle"><div class="title">Building and testing </div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p >There are several ways to integrate this library into your project: source code, package manager, and CMake.</p>
<h1><a class="anchor" id="autotoc_md17"></a>
Source code</h1>
<p >This library aims to provide a cross-platform JSON library, so it is written in ANSI C (actually C99, but compatible with strict C89). You can copy <code><a class="el" href="yyjson_8h.html">yyjson.h</a></code> and <code>yyjson.c</code> to your project and start using it without any configuration.</p>
<p >The library has been tested with <code>gcc</code>, <code>clang</code>, <code>msvc</code>, <code>tcc</code> compilers and <code>x86</code>, <code>arm</code>, <code>ppc</code>, <code>riscv</code>, <code>s390x</code> architectures in <a href="https://github.com/ibireme/yyjson/actions">Github CI</a>. Please <a href="https://github.com/ibireme/yyjson/issues/new?template=bug_report.md">report a bug</a> if you encounter any compilation issues.</p>
<p >The library has all features enabled by default, but you can trim out some of them by adding compile-time options. For example, you can disable the JSON writer to reduce the binary size when you don't need serialization, or disable comments support to improve parsing performance. See <code>Compile-time Options</code> for details.</p>
<h1><a class="anchor" id="autotoc_md18"></a>
Package manager</h1>
<p >You can use some popular package managers like <code>vcpkg</code>, <code>conan</code>, and <code>xmake</code> to download and install yyjson. The yyjson package in these package managers is kept up to date by community contributors. If the version is out of date, please create an issue or pull request on their repository.</p>
<h2><a class="anchor" id="autotoc_md19"></a>
Use vcpkg</h2>
<p >You can build and install yyjson using <a href="https://github.com/Microsoft/vcpkg/">vcpkg</a> dependency manager:</p>
<div class="fragment"><div class="line">git clone https://github.com/Microsoft/vcpkg.git</div>
<div class="line">cd vcpkg</div>
<div class="line">./bootstrap-vcpkg.sh  # ./bootstrap-vcpkg.bat for Powershell</div>
<div class="line">./vcpkg integrate install</div>
<div class="line">./vcpkg install yyjson</div>
</div><!-- fragment --><p >If the version is out of date, please <a href="https://github.com/Microsoft/vcpkg">create an issue or pull request</a> on the vcpkg repository.</p>
<h1><a class="anchor" id="autotoc_md20"></a>
CMake</h1>
<h2><a class="anchor" id="autotoc_md21"></a>
Use CMake to build a library</h2>
<p >Clone the repository and create build directory: </p><div class="fragment"><div class="line">git clone https://github.com/ibireme/yyjson.git</div>
<div class="line">mkdir build</div>
<div class="line">cd build</div>
</div><!-- fragment --><p> Build static library: </p><div class="fragment"><div class="line">cmake .. </div>
<div class="line">cmake --build .</div>
</div><!-- fragment --><p >Build shared library: </p><div class="fragment"><div class="line">cmake .. -DBUILD_SHARED_LIBS=ON</div>
<div class="line">cmake --build .</div>
</div><!-- fragment --><p >Supported CMake options:</p>
<ul>
<li><code>-DYYJSON_BUILD_TESTS=ON</code> Build all tests.</li>
<li><code>-DYYJSON_BUILD_FUZZER=ON</code> Build fuzzer with LibFuzzing.</li>
<li><code>-DYYJSON_BUILD_MISC=ON</code> Build misc.</li>
<li><code>-DYYJSON_BUILD_DOC=ON</code> Build documentation with doxygen.</li>
<li><code>-DYYJSON_ENABLE_COVERAGE=ON</code> Enable code coverage for tests.</li>
<li><code>-DYYJSON_ENABLE_VALGRIND=ON</code> Enable valgrind memory checker for tests.</li>
<li><code>-DYYJSON_ENABLE_SANITIZE=ON</code> Enable sanitizer for tests.</li>
<li><code>-DYYJSON_ENABLE_FASTMATH=ON</code> Enable fast-math for tests.</li>
<li><code>-DYYJSON_FORCE_32_BIT=ON</code> Force 32-bit for tests (gcc/clang/icc).</li>
<li><code>-DYYJSON_DISABLE_READER=ON</code> Disable JSON reader if you don't need it.</li>
<li><code>-DYYJSON_DISABLE_WRITER=ON</code> Disable JSON writer if you don't need it.</li>
<li><code>-DYYJSON_DISABLE_UTILS=ON</code> Disable JSON Pointer, JSON Patch and JSON Merge Patch.</li>
<li><code>-DYYJSON_DISABLE_FAST_FP_CONV=ON</code> Disable builtin fast floating-pointer conversion.</li>
<li><code>-DYYJSON_DISABLE_NON_STANDARD=ON</code> Disable non-standard JSON support at compile-time.</li>
<li><code>-DYYJSON_DISABLE_UTF8_VALIDATION=ON</code> Disable UTF-8 validation at compile-time.</li>
<li><code>-DYYJSON_DISABLE_UNALIGNED_MEMORY_ACCESS=ON</code> Disable unaligned memory access support at compile-time.</li>
</ul>
<h2><a class="anchor" id="autotoc_md22"></a>
Use CMake as a dependency</h2>
<p >You can download and unzip yyjson to your project directory and link it in your <code>CMakeLists.txt</code> file: </p><div class="fragment"><div class="line"># Add some options (optional)</div>
<div class="line">set(YYJSON_DISABLE_NON_STANDARD ON CACHE INTERNAL &quot;&quot;)</div>
<div class="line"> </div>
<div class="line"># Add the `yyjson` subdirectory</div>
<div class="line">add_subdirectory(vendor/yyjson)</div>
<div class="line"> </div>
<div class="line"># Link yyjson to your target</div>
<div class="line">target_link_libraries(your_target PRIVATE yyjson)</div>
</div><!-- fragment --><p >If your CMake version is higher than 3.11, you can use the following code to let CMake automatically download it: </p><div class="fragment"><div class="line">include(FetchContent)</div>
<div class="line"> </div>
<div class="line"># Let CMake download yyjson</div>
<div class="line">FetchContent_Declare(</div>
<div class="line">    yyjson</div>
<div class="line">    GIT_REPOSITORY https://github.com/ibireme/yyjson.git</div>
<div class="line">    GIT_TAG master # master, or version number, e.g. 0.6.0</div>
<div class="line">)</div>
<div class="line">FetchContent_GetProperties(yyjson)</div>
<div class="line">if(NOT yyjson_POPULATED)</div>
<div class="line">  FetchContent_Populate(yyjson)</div>
<div class="line">  add_subdirectory(${yyjson_SOURCE_DIR} ${yyjson_BINARY_DIR} EXCLUDE_FROM_ALL)</div>
<div class="line">endif()</div>
<div class="line"> </div>
<div class="line"># Link yyjson to your target</div>
<div class="line">target_link_libraries(your_target PRIVATE yyjson)</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md23"></a>
Use CMake to generate project</h2>
<p >If you want to build or debug yyjson with another compiler or IDE, try these commands: </p><div class="fragment"><div class="line"># Clang for Linux/Unix:</div>
<div class="line">cmake .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++</div>
<div class="line"> </div>
<div class="line"># Intel ICC for Linux/Unix:</div>
<div class="line">cmake .. -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc</div>
<div class="line"> </div>
<div class="line"># Other version of GCC:</div>
<div class="line">cmake .. -DCMAKE_C_COMPILER=/usr/local/gcc-8.2/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/gcc-8.2/bin/g++</div>
<div class="line"> </div>
<div class="line"># Microsoft Visual Studio for Windows:</div>
<div class="line">cmake .. -G &quot;Visual Studio 16 2019&quot; -A x64</div>
<div class="line">cmake .. -G &quot;Visual Studio 16 2019&quot; -A Win32</div>
<div class="line">cmake .. -G &quot;Visual Studio 15 2017 Win64&quot;</div>
<div class="line"> </div>
<div class="line"># Xcode for macOS:</div>
<div class="line">cmake .. -G Xcode</div>
<div class="line"> </div>
<div class="line"># Xcode for iOS:</div>
<div class="line">cmake .. -G Xcode -DCMAKE_SYSTEM_NAME=iOS</div>
<div class="line"> </div>
<div class="line"># Xcode with XCTest</div>
<div class="line">cmake .. -G Xcode -DYYJSON_BUILD_TESTS=ON</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md24"></a>
Use CMake to generate documentation</h2>
<p >This library uses <a href="https://www.doxygen.nl/">doxygen</a> to generate the documentation, (make sure you have <code>doxygen</code> installed before proceeding): </p><div class="fragment"><div class="line">cmake .. -DYYJSON_BUILD_DOC=ON</div>
<div class="line">cmake --build .</div>
</div><!-- fragment --><p> After executing this script, doxygen will generate HTML files, which can be found in <code>build/doxygen/html</code>. You can also access the pre-generated document online at: <a href="https://ibireme.github.io/yyjson/doc/doxygen/html/">https://ibireme.github.io/yyjson/doc/doxygen/html/</a></p>
<h2><a class="anchor" id="autotoc_md25"></a>
Testing With CMake and CTest</h2>
<p >Build and run all tests: </p><div class="fragment"><div class="line">cmake .. -DYYJSON_BUILD_TESTS=ON</div>
<div class="line">cmake --build .</div>
<div class="line">ctest --output-on-failure</div>
</div><!-- fragment --><p >Build and run tests with <a href="https://valgrind.org/">valgrind</a> memory checker, (make sure you have <code>valgrind</code> installed before proceeding): </p><div class="fragment"><div class="line">cmake .. -DYYJSON_BUILD_TESTS=ON -DYYJSON_ENABLE_VALGRIND=ON</div>
<div class="line">cmake --build .</div>
<div class="line">ctest --output-on-failure</div>
</div><!-- fragment --><p >Build and run tests with sanitizer (compiler should be <code>gcc</code> or <code>clang</code>): </p><div class="fragment"><div class="line">cmake .. -DYYJSON_BUILD_TESTS=ON -DYYJSON_ENABLE_SANITIZE=ON</div>
<div class="line">cmake --build .</div>
<div class="line">ctest --output-on-failure</div>
</div><!-- fragment --><p >Build and run code coverage with <code>gcc</code>: </p><div class="fragment"><div class="line">cmake .. -DCMAKE_BUILD_TYPE=Debug -DYYJSON_BUILD_TESTS=ON -DYYJSON_ENABLE_COVERAGE=ON</div>
<div class="line">cmake --build . --config Debug</div>
<div class="line">ctest --output-on-failure</div>
<div class="line"> </div>
<div class="line">lcov -c -d ./CMakeFiles --include &quot;*/yyjson.*&quot; -o cov.info</div>
<div class="line">genhtml cov.info -o ./cov_report</div>
</div><!-- fragment --><p >Build and run code coverage with <code>clang</code>: </p><div class="fragment"><div class="line">cmake .. -DCMAKE_BUILD_TYPE=Debug -DYYJSON_BUILD_TESTS=ON -DYYJSON_ENABLE_COVERAGE=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++</div>
<div class="line">cmake --build . --config Debug</div>
<div class="line"> </div>
<div class="line">export LLVM_PROFILE_FILE=cov/profile-%p.profraw</div>
<div class="line">ctest --output-on-failure</div>
<div class="line"> </div>
<div class="line">ctest_files=$(grep -o &quot;test_\w\+ &quot; CTestTestfile.cmake | uniq | tr &#39;\n&#39; &#39; &#39;)</div>
<div class="line">ctest_files=$(echo $ctest_files | sed &#39;s/  $//&#39; | sed &quot;s/ / -object /g&quot;)</div>
<div class="line">llvm-profdata merge -sparse cov/profile-*.profraw -o coverage.profdata</div>
<div class="line">llvm-cov show $ctest_files -instr-profile=coverage.profdata -format=html &gt; coverage.html</div>
</div><!-- fragment --><p >Build and run fuzz test with <a href="https://llvm.org/docs/LibFuzzer.html">LibFuzzer</a> (compiler should be <code>LLVM Clang</code>, while <code>Apple Clang</code> or <code>gcc</code> are not supported): </p><div class="fragment"><div class="line">cmake .. -DYYJSON_BUILD_FUZZER=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++</div>
<div class="line">cmake --build .</div>
<div class="line">./fuzzer -dict=fuzzer.dict ./corpus</div>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md26"></a>
Compile-time Options</h1>
<p >This library provides various compile-time options that can be defined as 1 to disable specific features during compilation.</p>
<p >● <b>YYJSON_DISABLE_READER</b><br  />
 Define this as 1 to disable the JSON reader.<br  />
 This will disable these functions at compile-time: </p><div class="fragment"><div class="line"><a class="code hl_function" href="yyjson_8h.html#acf234d21f0cb4b7fc89381ef25e9f0a8">yyjson_read_opts</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a605ac08b083fb65331d7fa5eb5d32225">yyjson_read_file</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#aeab3c2a1d86225e5b181fb1bba7587d4">yyjson_read</a>()</div>
<div class="ttc" id="ayyjson_8h_html_a605ac08b083fb65331d7fa5eb5d32225"><div class="ttname"><a href="yyjson_8h.html#a605ac08b083fb65331d7fa5eb5d32225">yyjson_read_file</a></div><div class="ttdeci">yyjson_api yyjson_doc * yyjson_read_file(const char *path, yyjson_read_flag flg, const yyjson_alc *alc, yyjson_read_err *err)</div></div>
<div class="ttc" id="ayyjson_8h_html_acf234d21f0cb4b7fc89381ef25e9f0a8"><div class="ttname"><a href="yyjson_8h.html#acf234d21f0cb4b7fc89381ef25e9f0a8">yyjson_read_opts</a></div><div class="ttdeci">yyjson_api yyjson_doc * yyjson_read_opts(char *dat, size_t len, yyjson_read_flag flg, const yyjson_alc *alc, yyjson_read_err *err)</div></div>
<div class="ttc" id="ayyjson_8h_html_aeab3c2a1d86225e5b181fb1bba7587d4"><div class="ttname"><a href="yyjson_8h.html#aeab3c2a1d86225e5b181fb1bba7587d4">yyjson_read</a></div><div class="ttdeci">yyjson_api_inline yyjson_doc * yyjson_read(const char *dat, size_t len, yyjson_read_flag flg)</div><div class="ttdef"><b>Definition:</b> yyjson.h:954</div></div>
</div><!-- fragment --><p> This will reduce the binary size by about 60%.<br  />
 It is recommended when JSON parsing is not required.</p>
<p >● <b>YYJSON_DISABLE_WRITER</b><br  />
 Define this as 1 to disable JSON writer.<br  />
 This will disable these functions at compile-time: </p><div class="fragment"><div class="line"><a class="code hl_function" href="yyjson_8h.html#ad231975496ac3788fe5d69804e295443">yyjson_write</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a2d82bd0dc78358326b03e28b9acc19e4">yyjson_write_file</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a43ccc01254525cef16699e72079e3e49">yyjson_write_opts</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a00409eb59aee687f7778d00510b59d38">yyjson_val_write</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a725cc27bd7bd37c1d18c41589abd34db">yyjson_val_write_file</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a79720744960c9b4fdabbfb28379bbeb4">yyjson_val_write_opts</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a881e2ee3f487385810829df8bc675f1f">yyjson_mut_write</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#ad2a7aa77fa66a593536e3d7c3edb1d7a">yyjson_mut_write_file</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a7af42d62aa1583986c687c5cd10b010e">yyjson_mut_write_opts</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a700da5ce5bf8bb9d3739cc73a0f51cdf">yyjson_mut_val_write</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#adf8b2d3c8b57e85d58108d58c68b0db5">yyjson_mut_val_write_file</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#abdaf14b79fe803289070c0e5d5a705b8">yyjson_mut_val_write_opts</a>()</div>
<div class="ttc" id="ayyjson_8h_html_a00409eb59aee687f7778d00510b59d38"><div class="ttname"><a href="yyjson_8h.html#a00409eb59aee687f7778d00510b59d38">yyjson_val_write</a></div><div class="ttdeci">yyjson_api_inline char * yyjson_val_write(const yyjson_val *val, yyjson_write_flag flg, size_t *len)</div><div class="ttdef"><b>Definition:</b> yyjson.h:1466</div></div>
<div class="ttc" id="ayyjson_8h_html_a2d82bd0dc78358326b03e28b9acc19e4"><div class="ttname"><a href="yyjson_8h.html#a2d82bd0dc78358326b03e28b9acc19e4">yyjson_write_file</a></div><div class="ttdeci">yyjson_api bool yyjson_write_file(const char *path, const yyjson_doc *doc, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)</div></div>
<div class="ttc" id="ayyjson_8h_html_a43ccc01254525cef16699e72079e3e49"><div class="ttname"><a href="yyjson_8h.html#a43ccc01254525cef16699e72079e3e49">yyjson_write_opts</a></div><div class="ttdeci">yyjson_api char * yyjson_write_opts(const yyjson_doc *doc, yyjson_write_flag flg, const yyjson_alc *alc, size_t *len, yyjson_write_err *err)</div></div>
<div class="ttc" id="ayyjson_8h_html_a700da5ce5bf8bb9d3739cc73a0f51cdf"><div class="ttname"><a href="yyjson_8h.html#a700da5ce5bf8bb9d3739cc73a0f51cdf">yyjson_mut_val_write</a></div><div class="ttdeci">yyjson_api_inline char * yyjson_mut_val_write(const yyjson_mut_val *val, yyjson_write_flag flg, size_t *len)</div><div class="ttdef"><b>Definition:</b> yyjson.h:1568</div></div>
<div class="ttc" id="ayyjson_8h_html_a725cc27bd7bd37c1d18c41589abd34db"><div class="ttname"><a href="yyjson_8h.html#a725cc27bd7bd37c1d18c41589abd34db">yyjson_val_write_file</a></div><div class="ttdeci">yyjson_api bool yyjson_val_write_file(const char *path, const yyjson_val *val, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)</div></div>
<div class="ttc" id="ayyjson_8h_html_a79720744960c9b4fdabbfb28379bbeb4"><div class="ttname"><a href="yyjson_8h.html#a79720744960c9b4fdabbfb28379bbeb4">yyjson_val_write_opts</a></div><div class="ttdeci">yyjson_api char * yyjson_val_write_opts(const yyjson_val *val, yyjson_write_flag flg, const yyjson_alc *alc, size_t *len, yyjson_write_err *err)</div></div>
<div class="ttc" id="ayyjson_8h_html_a7af42d62aa1583986c687c5cd10b010e"><div class="ttname"><a href="yyjson_8h.html#a7af42d62aa1583986c687c5cd10b010e">yyjson_mut_write_opts</a></div><div class="ttdeci">yyjson_api char * yyjson_mut_write_opts(const yyjson_mut_doc *doc, yyjson_write_flag flg, const yyjson_alc *alc, size_t *len, yyjson_write_err *err)</div></div>
<div class="ttc" id="ayyjson_8h_html_a881e2ee3f487385810829df8bc675f1f"><div class="ttname"><a href="yyjson_8h.html#a881e2ee3f487385810829df8bc675f1f">yyjson_mut_write</a></div><div class="ttdeci">yyjson_api_inline char * yyjson_mut_write(const yyjson_mut_doc *doc, yyjson_write_flag flg, size_t *len)</div><div class="ttdef"><b>Definition:</b> yyjson.h:1361</div></div>
<div class="ttc" id="ayyjson_8h_html_abdaf14b79fe803289070c0e5d5a705b8"><div class="ttname"><a href="yyjson_8h.html#abdaf14b79fe803289070c0e5d5a705b8">yyjson_mut_val_write_opts</a></div><div class="ttdeci">yyjson_api char * yyjson_mut_val_write_opts(const yyjson_mut_val *val, yyjson_write_flag flg, const yyjson_alc *alc, size_t *len, yyjson_write_err *err)</div></div>
<div class="ttc" id="ayyjson_8h_html_ad231975496ac3788fe5d69804e295443"><div class="ttname"><a href="yyjson_8h.html#ad231975496ac3788fe5d69804e295443">yyjson_write</a></div><div class="ttdeci">yyjson_api_inline char * yyjson_write(const yyjson_doc *doc, yyjson_write_flag flg, size_t *len)</div><div class="ttdef"><b>Definition:</b> yyjson.h:1257</div></div>
<div class="ttc" id="ayyjson_8h_html_ad2a7aa77fa66a593536e3d7c3edb1d7a"><div class="ttname"><a href="yyjson_8h.html#ad2a7aa77fa66a593536e3d7c3edb1d7a">yyjson_mut_write_file</a></div><div class="ttdeci">yyjson_api bool yyjson_mut_write_file(const char *path, const yyjson_mut_doc *doc, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)</div></div>
<div class="ttc" id="ayyjson_8h_html_adf8b2d3c8b57e85d58108d58c68b0db5"><div class="ttname"><a href="yyjson_8h.html#adf8b2d3c8b57e85d58108d58c68b0db5">yyjson_mut_val_write_file</a></div><div class="ttdeci">yyjson_api bool yyjson_mut_val_write_file(const char *path, const yyjson_mut_val *val, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)</div></div>
</div><!-- fragment --><p> This will reduce the binary size by about 30%.<br  />
 It is recommended when JSON serialization is not required.</p>
<p >● <b>YYJSON_DISABLE_UTILS</b><br  />
 Define this as 1 to disable JSON Pointer, JSON Patch and JSON Merge Patch supports.</p>
<p >This will disable these functions at compile-time: </p><div class="fragment"><div class="line">yyjson_ptr_xxx()</div>
<div class="line">yyjson_mut_ptr_xxx()</div>
<div class="line">yyjson_doc_ptr_xxx()</div>
<div class="line">yyjson_mut_doc_ptr_xxx()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a2d0864410efdd15e4591fecc0b4c082c">yyjson_patch</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#ad4cca957150bd6f19fa12a4f907dffee">yyjson_mut_patch</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a9026faa4e022392c28e8f9afa553362f">yyjson_merge_patch</a>()</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#aad64266ebfbdd2a9627050cf1f3f48d7">yyjson_mut_merge_patch</a>()</div>
<div class="ttc" id="ayyjson_8h_html_a2d0864410efdd15e4591fecc0b4c082c"><div class="ttname"><a href="yyjson_8h.html#a2d0864410efdd15e4591fecc0b4c082c">yyjson_patch</a></div><div class="ttdeci">yyjson_api yyjson_mut_val * yyjson_patch(yyjson_mut_doc *doc, yyjson_val *orig, yyjson_val *patch, yyjson_patch_err *err)</div></div>
<div class="ttc" id="ayyjson_8h_html_a9026faa4e022392c28e8f9afa553362f"><div class="ttname"><a href="yyjson_8h.html#a9026faa4e022392c28e8f9afa553362f">yyjson_merge_patch</a></div><div class="ttdeci">yyjson_api yyjson_mut_val * yyjson_merge_patch(yyjson_mut_doc *doc, yyjson_val *orig, yyjson_val *patch)</div></div>
<div class="ttc" id="ayyjson_8h_html_aad64266ebfbdd2a9627050cf1f3f48d7"><div class="ttname"><a href="yyjson_8h.html#aad64266ebfbdd2a9627050cf1f3f48d7">yyjson_mut_merge_patch</a></div><div class="ttdeci">yyjson_api yyjson_mut_val * yyjson_mut_merge_patch(yyjson_mut_doc *doc, yyjson_mut_val *orig, yyjson_mut_val *patch)</div></div>
<div class="ttc" id="ayyjson_8h_html_ad4cca957150bd6f19fa12a4f907dffee"><div class="ttname"><a href="yyjson_8h.html#ad4cca957150bd6f19fa12a4f907dffee">yyjson_mut_patch</a></div><div class="ttdeci">yyjson_api yyjson_mut_val * yyjson_mut_patch(yyjson_mut_doc *doc, yyjson_mut_val *orig, yyjson_mut_val *patch, yyjson_patch_err *err)</div></div>
</div><!-- fragment --><p> It is recommended when these functions are not required.</p>
<p >● <b>YYJSON_DISABLE_FAST_FP_CONV</b><br  />
 Define this as 1 to disable the fast floating-point number conversion in yyjson, and use libc's <code>strtod/snprintf</code> instead.<br  />
 This will reduce binary size by about 30%, but significantly slows down the floating-point read/write speed.<br  />
 It is recommended when dealing with JSON that contains a minimal number of floating-point numbers.</p>
<p >● <b>YYJSON_DISABLE_NON_STANDARD</b><br  />
 Define this as 1 to disable non-standard JSON support at compile-time:</p>
<ul>
<li>Reading and writing inf/nan literal, such as <code>NaN</code>, <code>-Infinity</code>.</li>
<li>Single line and multiple line comments.</li>
<li>Single trailing comma at the end of an object or array.</li>
<li>Invalid unicode in string value.</li>
</ul>
<p >This will also invalidate these run-time options: </p><div class="fragment"><div class="line"><a class="code hl_variable" href="yyjson_8h.html#a4b5c0a7092625f0324bccec938f8862f">YYJSON_READ_ALLOW_INF_AND_NAN</a></div>
<div class="line"><a class="code hl_variable" href="yyjson_8h.html#aff1d62b68993630e74355e4611b77520">YYJSON_READ_ALLOW_COMMENTS</a></div>
<div class="line"><a class="code hl_variable" href="yyjson_8h.html#a046c7832484dab943bed61ffac274e9c">YYJSON_READ_ALLOW_TRAILING_COMMAS</a></div>
<div class="line"><a class="code hl_variable" href="yyjson_8h.html#abdbf139ee03d263c8a833fbef8cbf63c">YYJSON_READ_ALLOW_INVALID_UNICODE</a></div>
<div class="line"><a class="code hl_variable" href="yyjson_8h.html#a38fa90e4cf75b0a78148de2058c1b3bd">YYJSON_WRITE_ALLOW_INF_AND_NAN</a></div>
<div class="line"><a class="code hl_variable" href="yyjson_8h.html#ae2709fd5ec704ef7a569d62195e4652d">YYJSON_WRITE_ALLOW_INVALID_UNICODE</a></div>
<div class="ttc" id="ayyjson_8h_html_a046c7832484dab943bed61ffac274e9c"><div class="ttname"><a href="yyjson_8h.html#a046c7832484dab943bed61ffac274e9c">YYJSON_READ_ALLOW_TRAILING_COMMAS</a></div><div class="ttdeci">static const yyjson_read_flag YYJSON_READ_ALLOW_TRAILING_COMMAS</div><div class="ttdef"><b>Definition:</b> yyjson.h:758</div></div>
<div class="ttc" id="ayyjson_8h_html_a38fa90e4cf75b0a78148de2058c1b3bd"><div class="ttname"><a href="yyjson_8h.html#a38fa90e4cf75b0a78148de2058c1b3bd">YYJSON_WRITE_ALLOW_INF_AND_NAN</a></div><div class="ttdeci">static const yyjson_write_flag YYJSON_WRITE_ALLOW_INF_AND_NAN</div><div class="ttdef"><b>Definition:</b> yyjson.h:1100</div></div>
<div class="ttc" id="ayyjson_8h_html_a4b5c0a7092625f0324bccec938f8862f"><div class="ttname"><a href="yyjson_8h.html#a4b5c0a7092625f0324bccec938f8862f">YYJSON_READ_ALLOW_INF_AND_NAN</a></div><div class="ttdeci">static const yyjson_read_flag YYJSON_READ_ALLOW_INF_AND_NAN</div><div class="ttdef"><b>Definition:</b> yyjson.h:765</div></div>
<div class="ttc" id="ayyjson_8h_html_abdbf139ee03d263c8a833fbef8cbf63c"><div class="ttname"><a href="yyjson_8h.html#abdbf139ee03d263c8a833fbef8cbf63c">YYJSON_READ_ALLOW_INVALID_UNICODE</a></div><div class="ttdeci">static const yyjson_read_flag YYJSON_READ_ALLOW_INVALID_UNICODE</div><div class="ttdef"><b>Definition:</b> yyjson.h:779</div></div>
<div class="ttc" id="ayyjson_8h_html_ae2709fd5ec704ef7a569d62195e4652d"><div class="ttname"><a href="yyjson_8h.html#ae2709fd5ec704ef7a569d62195e4652d">YYJSON_WRITE_ALLOW_INVALID_UNICODE</a></div><div class="ttdeci">static const yyjson_write_flag YYJSON_WRITE_ALLOW_INVALID_UNICODE</div><div class="ttdef"><b>Definition:</b> yyjson.h:1111</div></div>
<div class="ttc" id="ayyjson_8h_html_aff1d62b68993630e74355e4611b77520"><div class="ttname"><a href="yyjson_8h.html#aff1d62b68993630e74355e4611b77520">YYJSON_READ_ALLOW_COMMENTS</a></div><div class="ttdeci">static const yyjson_read_flag YYJSON_READ_ALLOW_COMMENTS</div><div class="ttdef"><b>Definition:</b> yyjson.h:761</div></div>
</div><!-- fragment --><p >This will reduce binary size by about 10%, and slightly improves performance.<br  />
 It is recommended when not dealing with non-standard JSON.</p>
<p >● <b>YYJSON_DISABLE_UTF8_VALIDATION</b><br  />
 Define as 1 to disable UTF-8 validation at compile time.</p>
<p >If all input strings are guaranteed to be valid UTF-8 encoding (for example, some language's String object has already validated the encoding), using this flag can avoid redundant UTF-8 validation in yyjson.</p>
<p >This flag can speed up the reading and writing speed of non-ASCII encoded strings by about 3% to 7%.</p>
<p >Note: If this flag is used while passing in illegal UTF-8 strings, the following errors may occur:</p>
<ul>
<li>Escaped characters are ignored when parsing JSON strings.</li>
<li>Ending quotes are ignored when parsing JSON strings, causing the string to be concatenated to the next value.</li>
<li>When accessing <code><a class="el" href="yyjson_8h.html#structyyjson__mut__val">yyjson_mut_val</a></code> for serialization, the string ending is accessed out of bounds, causing a segmentation fault.</li>
</ul>
<p >● <b>YYJSON_EXPORTS</b><br  />
 Define this as 1 to export symbols when building the library as a Windows DLL.</p>
<p >● <b>YYJSON_IMPORTS</b><br  />
 Define this as 1 to import symbols when using the library as a Windows DLL. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.9.4-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Documentation for <a href="https://github.com/ibireme/yyjson" target="_blank">yyjson</a>, generated by <a href="https://www.doxygen.org/index.html" target="_blank">doxygen</a> 1.9.4 </li>
  </ul>
</div>
</body>
</html>
